﻿<!--
Family Lines code is provided using the Apache License V2.0, January 2004 http://www.apache.org/licenses/
-->
 <UserControl x:Class="KBS.FamilyLines.Controls.ViewAllFacts"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:properties="clr-namespace:KBS.FamilyLines.Properties"
             mc:Ignorable="d" 
             d:DesignHeight="600" 
             d:DesignWidth="300"
>

    <UserControl.Resources>
        <Style TargetType="{x:Type TextBox}" BasedOn="{x:Null}">
            <Setter Property="Margin" Value="3,3,0,0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Height" Value="22"/>
        </Style>
        <Style TargetType="{x:Type Label}" BasedOn="{x:Null}">
            <Setter Property="Margin" Value="3,3,0,0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Foreground" Value="{DynamicResource InputFontColor}"/>
        </Style>
    </UserControl.Resources>
    
    <StackPanel Width="600">

        <!-- Header -->
        <Border Padding="5,0,5,0" Background="{DynamicResource BackgroundBrush}" BorderBrush="{DynamicResource BorderBrush}" 
                BorderThickness="1,1,1,0"  CornerRadius="{DynamicResource AboutBorderTopCorner}" 
                Height="30" MinWidth="300" Width="Auto">
            <Grid>
                <!-- Person name -->
                <TextBlock Text="{Binding Path=PName, Mode=Default}"
                   Style="{DynamicResource HeaderStyle}" FontWeight="Bold" Height="23.94" 
                   Margin="5,1,10,0" DockPanel.Dock="Left" TextTrimming="CharacterEllipsis" 
                   Foreground="{DynamicResource HeaderFontColor}"/>
                <Button Content="X" x:Name="CloseButton" Click="CloseButton_Click"  Height="15"  
                        HorizontalAlignment="Right" Width="15" Style="{DynamicResource RedButtonStyle}"/>
            </Grid>
        </Border>

        <!-- Content -->
        <Border BorderBrush="{DynamicResource BorderBrush}" 
                Background="{DynamicResource InputBackgroundBrush}" 
                BorderThickness="1,1,1,1">
            
            <Grid Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="2*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <DataGrid x:Name="DisplayGrid"
                          Height="180"
                          VerticalScrollBarVisibility="Auto"
                          Grid.Row="0"
                          ColumnWidth="Auto"
                          IsReadOnly="True"
                          SelectionChanged="DisplayGrid_SelectionChanged"
                          ItemsSource="{Binding Path=Facts}" 
                          AutoGenerateColumns="False"
                          CanUserReorderColumns="True"
                          CanUserResizeColumns="True"
                          CanUserSortColumns="True"
                          SelectionMode="Single" 
                          SelectionUnit="FullRow">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="{x:Static properties:Resources.FactEventHead}"
                                            Binding="{Binding Path=EventName, Mode=OneWay}" />
                        <DataGridTextColumn Header="{x:Static properties:Resources.DateHead}" 
                                            Binding="{Binding Path=Date.DateString}"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.PlaceHead}" 
                                            Binding="{Binding Path=Place}"/>
                        <DataGridTextColumn Header="{x:Static properties:Resources.DescHead}" 
                                            Binding="{Binding Path=Description}"/>
                    </DataGrid.Columns>
                </DataGrid>
                <StackPanel Grid.Row="1" Orientation="Horizontal">
                    <Button x:Name="addBtn"  Margin="5" Click="addBtn_Click" Content="{x:Static properties:Resources.Add}"/>
                    <Button x:Name="delBtn"  Margin="5" Click="delBtn_Click" Content="{x:Static properties:Resources.Delete}"/>
                    <Button x:Name="resetBtn" Margin="5" Click="resetBtn_Click" Content="{x:Static properties:Resources.Reset}"/>
                    <Button x:Name="saveBtn" Margin="5" Click="saveBtn_Click" Content="{x:Static properties:Resources.Save}"/>
                    <Button x:Name="cancelBtn" Margin="5" Click="cancelBtn_Click" Content="{x:Static properties:Resources.Cancel}"/>
                </StackPanel>
                <Grid x:Name="eventDetails" Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="22px"/> <!-- prevent flicker when flip between label & combo -->
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>                    
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Grid.Column="0"
                           Content="{x:Static properties:Resources.FactEventHead}" 
                           HorizontalAlignment="Right"/>
                    <Label Grid.Row="0" Grid.Column="1"
                           x:Name="eventName" />
                    <ComboBox Grid.Row="0" Grid.Column="1"
                              x:Name="eventPick"
                              Margin="3,0,0,0"
                              Width="200"
                              HorizontalAlignment="Left"
                              Visibility="Collapsed"/>
                    <Label Grid.Row="1" Grid.Column="0" 
                           Content="{x:Static properties:Resources.DateHead}" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="1" Grid.Column="1" 
                             x:Name="txtDate"/>
                    <Label Grid.Row="2" Grid.Column="0" 
                           Content="{x:Static properties:Resources.PlaceHead}" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="2" Grid.Column="1" 
                             x:Name="txtPlace" />
                    <Label Grid.Row="3" Grid.Column="0" 
                           Content="{x:Static properties:Resources.DescHead}" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="3" Grid.Column="1" 
                             x:Name="txtDesc" />
                    <Label Grid.Row="4" Grid.Column="0" 
                           Content="{x:Static properties:Resources.Address}" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="4" Grid.Column="1" 
                             x:Name="txtAddress"
                             Height="50"
                             TextWrapping="Wrap"
                             VerticalScrollBarVisibility="Visible"
                             AcceptsReturn="True"
                             />
                    <Label Grid.Row="5" Grid.Column="0" 
                           Content="{x:Static properties:Resources.Age}" 
                           HorizontalAlignment="Right"/>
                    
                    <!-- TODO not ready for V0.5 -->
                    <TextBox Grid.Row="5" Grid.Column="1" 
                             IsEnabled="False"
                             x:Name="txtAge" />
                    <Label Grid.Row="6" Grid.Column="0" 
                           Content="{x:Static properties:Resources.Agency}" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="6" Grid.Column="1" 
                             x:Name="txtAgency" />
                    <Label Grid.Row="7" Grid.Column="0" 
                           Content="{x:Static properties:Resources.Cause}" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="7" Grid.Column="1" 
                             x:Name="txtCause" />
                    <!-- TODO don't have certainty yet
                    <Label Grid.Row="8" Grid.Column="0" 
                           Content="Certainty:" 
                           HorizontalAlignment="Right"/>
                    <TextBox Grid.Row="8" Grid.Column="1" 
                             x:Name="txtCertainty" />-->
                </Grid>
                <StackPanel Grid.Row="3" Orientation="Horizontal">
                    <!-- TODO not ready for V0.5 -->
                    <Button x:Name="NotesBtn"  Margin="5" 
                            IsEnabled="False"
                            Content="{x:Static properties:Resources.Notes}"/>
                    <Button x:Name="MMediaBtn" Margin="5" 
                            IsEnabled="False"
                            Content="{x:Static properties:Resources.Photos}"/>
                    <Button x:Name="SourceBtn" Margin="5" 
                            IsEnabled="False"
                            Content="{x:Static properties:Resources.Sources}"/>
                </StackPanel>
            </Grid>
        </Border>

        <!-- Footer -->
        <Border Background="{DynamicResource BackgroundBrush}" Height="15" 
                BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1,0,1,1" 
                CornerRadius="{DynamicResource AboutBorderBottomCorner}"/>

    </StackPanel>

</UserControl>
